import bcrypt from 'bcrypt';


export async function passwordParse(password: string): Promise<string> {
  const salt = await bcrypt.genSalt(10);
  const passHash = await bcrypt.hash(password, salt);
  return passHash;
}

export async function passwordValidate(source: string, encode: string): Promise<boolean> {
  return await bcrypt.compare(source, encode);
}

export default {
  parse: passwordParse,
  validate: passwordValidate,
}